package com.example.hfiveandaplication.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * 身份证认证信息
 */
public class IdentityData implements Serializable {

    /**
     * identity : {"address":"KP.SAWAH JL.KENANGA III NO.43","birthPlace":"","birthday":"","bloodType":"","city":"KOTA BEKASI","district":"PONDOK MELATI","expiryDate":"26-09-2017","gender":"PEREMPUAN","identityCardNum":"3275126609880006","maritalStatus":"KAWIN","nationality":"WNI","occupation":"MENGURUS RUMAH TANGGA","province":"JAWA BARAT","realName":"SITI MASYITOH","religion":"KRISTEN","rt":"005","rw":"002","village":"JATIMELATI"}
     */

    private IdentityBean identity;
    /**
     * imageInfo : {"fileType":1,"imageName":"file","imagePath":"/Users/wxc/Desktop//APP/2018-12/20/9fpKkFAU.jpg/kSvcdLHz .jpg","imageUrl":"http://47.92.118.116/Users/wxc/Desktop//APP/2018-12/20/9f pKkFAU.jpg/kSvcdLHz.jpg"}
     */

    private ImageInfoBean imageInfo;

    public IdentityBean getIdentity() {
        return identity;
    }

    public void setIdentity(IdentityBean identity) {
        this.identity = identity;
    }

    public ImageInfoBean getImageInfo() {
        return imageInfo;
    }

    public void setImageInfo(ImageInfoBean imageInfo) {
        this.imageInfo = imageInfo;
    }

    public static class IdentityBean implements Serializable {
        /**
         * address : KP.SAWAH JL.KENANGA III NO.43
         * birthPlace :
         * birthday :
         * bloodType :
         * city : KOTA BEKASI
         * district : PONDOK MELATI
         * expiryDate : 26-09-2017
         * gender : PEREMPUAN
         * identityCardNum : 3275126609880006
         * maritalStatus : KAWIN
         * nationality : WNI
         * occupation : MENGURUS RUMAH TANGGA
         * province : JAWA BARAT
         * realName : SITI MASYITOH
         * religion : KRISTEN
         * rt : 005
         * rw : 002
         * village : JATIMELATI
         */

        private String birthday;//出生日期
        private String city;//城市
        private String district;//区
        private String identityCardNum;//身份证
        private String maritalStatus;//婚姻状况
        private String province;//省
        private String realName;//证件姓名
        private String religion;//宗教


        public String getBirthday() {
            return birthday;
        }

        public void setBirthday(String birthday) {
            this.birthday = birthday;
        }

        public String getCity() {
            return city;
        }

        public void setCity(String city) {
            this.city = city;
        }

        public String getDistrict() {
            return district;
        }

        public void setDistrict(String district) {
            this.district = district;
        }

        public String getIdentityCardNum() {
            return identityCardNum;
        }

        public void setIdentityCardNum(String identityCardNum) {
            this.identityCardNum = identityCardNum;
        }

        public String getMaritalStatus() {
            return maritalStatus;
        }

        public void setMaritalStatus(String maritalStatus) {
            this.maritalStatus = maritalStatus;
        }

        public String getProvince() {
            return province;
        }

        public void setProvince(String province) {
            this.province = province;
        }

        public String getRealName() {
            return realName;
        }

        public void setRealName(String realName) {
            this.realName = realName;
        }

        public String getReligion() {
            return religion;
        }

        public void setReligion(String religion) {
            this.religion = religion;
        }

        public IdentityBean() {
        }

        public IdentityBean(AuthUserInfoData.IdentityBean identityBean) {
            realName = identityBean.getRealName();
            identityCardNum = identityBean.getIdentityCardNum();
            religion = identityBean.getReligion();
            birthday = identityBean.getBirthday();
            province = identityBean.getProvince();
            city = identityBean.getCity();
            district = identityBean.getDistrict();
            maritalStatus = identityBean.getMaritalStatus();
        }

        public IdentityBean(String[] value) {
            realName = value[0];
            identityCardNum = value[1];
            religion = value[2];
            birthday = value[3];
            province = value[4];
            city = value[5];
            district = value[6];
            maritalStatus = value[7];
        }

        @Override
        public String toString() {
            return "IdentityBean{" +
                    ", birthday='" + birthday + '\'' +
                    ", city='" + city + '\'' +
                    ", district='" + district + '\'' +
                    ", identityCardNum='" + identityCardNum + '\'' +
                    ", maritalStatus='" + maritalStatus + '\'' +
                    ", province='" + province + '\'' +
                    ", realName='" + realName + '\'' +
                    ", religion='" + religion + '\'' +
                    '}';
        }

        public String[] toArray() {
            return new String[]{realName, identityCardNum, religion,
                    birthday, province, city, district, maritalStatus,};
        }

        public Map<String, Object> toMap() {
            Map<String, Object> map = new HashMap<>();
            map.put("realName", realName);
            map.put("identityCardNum", identityCardNum);
            map.put("religion", religion);
            map.put("birthday", birthday);
            map.put("province", province);
            map.put("city", city);
            map.put("district", district);
            map.put("maritalStatus", maritalStatus);
            return map;
        }
    }

    public static class ImageInfoBean implements Parcelable {
        /**
         * fileType : 1
         * imageName : file
         * imagePath : /Users/wxc/Desktop//APP/2018-12/20/9fpKkFAU.jpg/kSvcdLHz .jpg
         * imageUrl : http://47.92.118.116/Users/wxc/Desktop//APP/2018-12/20/9f pKkFAU.jpg/kSvcdLHz.jpg
         */

        private int fileType;
        private String imageName;
        private String imagePath;
        private String imageUrl;

        protected ImageInfoBean(Parcel in) {
            fileType = in.readInt();
            imageName = in.readString();
            imagePath = in.readString();
            imageUrl = in.readString();
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(fileType);
            dest.writeString(imageName);
            dest.writeString(imagePath);
            dest.writeString(imageUrl);
        }

        @Override
        public int describeContents() {
            return 0;
        }

        public static final Creator<ImageInfoBean> CREATOR = new Creator<ImageInfoBean>() {
            @Override
            public ImageInfoBean createFromParcel(Parcel in) {
                return new ImageInfoBean(in);
            }

            @Override
            public ImageInfoBean[] newArray(int size) {
                return new ImageInfoBean[size];
            }
        };

        public int getFileType() {
            return fileType;
        }

        public void setFileType(int fileType) {
            this.fileType = fileType;
        }

        public String getImageName() {
            return imageName;
        }

        public void setImageName(String imageName) {
            this.imageName = imageName;
        }

        public String getImagePath() {
            return imagePath;
        }

        public void setImagePath(String imagePath) {
            this.imagePath = imagePath;
        }

        public String getImageUrl() {
            return imageUrl;
        }

        public void setImageUrl(String imageUrl) {
            this.imageUrl = imageUrl;
        }
    }
}
